﻿@model IEnumerable<BlogModels.Blog>
@using X.PagedList
@using X.PagedList.Mvc
@* 必须引入 X.PagedList和X.PagedList.Mvc命名空间，才能实现分页功能 *@
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}
@Styles.Render("~/Content/admin/css/mainlist")
<table width="99%" border="0" cellspacing="0" cellpadding="0" id="searchmain">
    <tr>
        <td width="99%" align="left" valign="top">您的位置：搜索结果列表</td>
    </tr>
    <tr>
        <td align="left" valign="top">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" id="search">
                <tr>
                    <td width="90%" align="left" valign="middle">
                        @*查询检索入口，Form表单提交到Blog控制器Post方法Seach（）*@
                        @using (Html.BeginForm("Seach", "Blog"))  
                        {
                            @Html.AntiForgeryToken()
                            <span>博客标题：</span>
                            <input type="text" id="seach" name="seach" value="" class="text-word">
                            <input name="" type="submit" value="查询" class="text-but">
                        }
                    </td>
                    <td width="10%" align="center" valign="middle" style="text-align:right; width:150px;">
                        <a href="~/Blog/Create" target="_self" onFocus="this.blur()" class="add">新增博客</a>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="left" valign="top">

            <table width="100%" border="0" cellspacing="0" cellpadding="0" id="main-tab">
                <tr>
                    <th align="center" valign="middle" class="borderright">自动编号</th>
                    <th align="center" valign="middle" class="borderright">博客标题</th>
                    <th align="center" valign="middle" class="borderright">添加时间</th>
                    <th align="center" valign="middle" class="borderright">修改时间</th>
                    <th align="center" valign="middle">操作</th>
                </tr>
                @foreach (var item in Model)
                {
                    <tr onMouseOut="this.style.backgroundColor='#ffffff'" onMouseOver="this.style.backgroundColor='#edf5ff'">
                        <td align="center" valign="middle" class="borderright borderbottom">
                            @Html.DisplayFor(modelItem => item.Id)
                        </td>
                        <td align="center" valign="middle" class="borderright borderbottom">
                            @Html.DisplayFor(modelItem => item.Title)
                        </td>
                        <td align="center" valign="middle" class="borderright borderbottom">
                           @Html.DisplayFor(modelItem => item.AddTime)
                        </td>
                        <td align="center" valign="middle" class="borderright borderbottom">
                            @Html.DisplayFor(modelItem => item.EditTime)
                        </td>
                        <td align="center" valign="middle" class="borderbottom">
                            @Html.ActionLink("编辑", "Edit", new { id = item.Id }) |
                            @Html.ActionLink("浏览", "Details", new { id = item.Id }) |
                            @Html.ActionLink("删除", "Delete", new { id = item.Id })
                        </td>
                    </tr>
                }
            </table>
        </td>
    </tr>
    <tr>
        <td align="left" valign="top" class="fenye">
            @* 分页按钮 *@
            @Html.PagedListPager((IPagedList)Model, page => Url.Action("Index", new { page }))
        </td>
    </tr>
</table>